﻿
Imports System.IO
Imports System.Resources
Imports SponsorshipGui.ctlRelationships

Public Class frmMain

    Private _Slideshow As New List(Of Image)
    Private _RecentActivityManager As RecentActivityManager
    Private _RelationshipsManager As RelationshipsManager
    Private _AuditTrailManager As AuditTrailManager

    Private Sub SlideshowTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SlideshowTimer.Tick

        Static lId As Long

        lId = +1
        ' PictureBox2.Image = From img In _Slideshow Where img.Tag Like "%2" Select img
        If _Slideshow.Count = 0 Then
            '            _Slideshow.Add(ResourceManager.GetObject("images.jpeg"))
            '            _Slideshow.Add(slide2)
            '            _Slideshow.Add(slide3)
            '            _Slideshow.Add(slide4)
            '            _Slideshow.Add(slide5)
        End If

    End Sub

    Private Sub frmMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim frmLogin As New frmLogin
        frmLogin.ShowDialog(Me)

        txtDatabase.Text = SponsorshipLogic.Information.Database

    End Sub

    Private Sub tabMainView_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        Select Case tabMainView.SelectedTab.Name
            Case "tabRecentActivities"
                If _RecentActivityManager Is Nothing Then
                    _RecentActivityManager = New RecentActivityManager(CtlRecentActivity1)
                End If

            Case "tabRelationships"
                If _RelationshipsManager Is Nothing Then
                    _RelationshipsManager = New RelationshipsManager(Relationships1)
                    _RelationshipsManager.Fill()
                End If

            Case "tabAuditTrail"
                If _AuditTrailManager Is Nothing Then


                End If
        End Select

    End Sub

    Private Sub tabMainView_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Select Case tabMainView.SelectedTab.Name.ToString
            Case "tabBirthdays"

            Case "tabAuditTrail"
                CtlAuditTrail1.Table = SponsorshipLogic.AuditTrail.Table

        End Select
    End Sub

    Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim Id As Integer = Relationships1.SelectedRelationshipId
        If Id > 0 Then
            Dim oFrm As New frmRelationship
            oFrm.RelationshipId = Relationships1.SelectedRelationshipId
            oFrm.Show(Me)
        End If
    End Sub

    Private Sub Relationships1_OpenRelationship(ByVal Id As Integer) Handles Relationships1.OpenRelationship
        Dim fRelationship As New frmRelationship
        If Id > 0 Then
            Dim oFrm As New frmRelationship
            oFrm.RelationshipId = Id
            oFrm.Show(Me)
        End If
    End Sub

    Private Sub Relationships1_Reload() Handles Relationships1.Reload
        Dim dt As New DataTable
        Dim iRows As Integer = SponsorshipLogic.Relationship.GetRelationships(Relationships1.Filter, dt)
        Relationships1.DataTable = dt
    End Sub

    Private Sub Relationships1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub Relationships1_Load_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Relationships1.Load

    End Sub
End Class